package cn.kimoon.dau_android;

import android.annotation.SuppressLint;
import android.support.v4.app.Fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;

import java.util.LinkedList;

import cn.kimoon.dau_android.Model.ModelContactItem;

/**
 * Created by xiangdong on 2016/11/23.
 */

public class WarningFragment extends Fragment {
    private LinkedList<ModelContactItem> contact;
    private WarningAdapter adapter;

    public void setContact(LinkedList<ModelContactItem> contact) {
        this.contact = contact;

        // 更新界面数据
        if (adapter != null) {
            adapter.setmData(contact);
        }
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_warning, container, false);
        initSubViews(view);
        return view;
    }

    private void initSubViews(View view) {
        ListView listView = (ListView) view.findViewById(R.id.warning_list_view);
        adapter = new WarningAdapter(contact, getActivity());
        listView.setAdapter(adapter);
    }
}
